'''
Created on 2010-6-24

@author: Zizon
'''
from google.appengine.ext import webapp
from google.appengine.api.memcache import Client
from com.google.code.zkit.twitter.oauth.Oauth import unquote

class ProxyHandler(webapp.RequestHandler):
    client = Client()
    
    # convert query strings to dictionary    
    @classmethod
    def convertParameters(self, source , force_to_lower=True):
        parameters = {}
        for pairs in source.split("&"):
            item = pairs.split("=")
            if len(item) == 2:
                if "status" != item[0] and force_to_lower:
                    parameters[item[0]] = unquote(item[1]).lower()
                else:
                    parameters[item[0]] = unquote(item[1])
        return parameters
    
        
